﻿using JZ_UDI.DataAccess;
using JZ_UDI.DataAccess.DataEntity;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JZ_UDI.BLL
{
    public class LoginBLL
    {

        public User isLogin(User user)
        {

            using (var context = new EFDbContext())
            {
                
                try
                {
                    User _user = (User)context.Users.ToList().Find(o => o.UserName == user.UserName);
                    return _user;
                }
                catch (System.NullReferenceException ex)
                {
                    Global.SaveLogger(LogLevel.Warn, Global.logger.Name, ex.Message+"_非法帐号："+ user.UserName);
                    return null;
                }
            }
        }

    }
}
